class_name FSM
extends Node

enum State{
	WALK = 0,
	BACK = 1,
	YUN = 2
}

var states:Array=[]
var current_state:BaseState
func _ready():
	states = get_children()

func _process(delta):
	if is_instance_valid(current_state):
		current_state.do(delta)

func change_state(id):
	if is_instance_valid(current_state):
		current_state.exit()
	current_state = states[id]
	current_state.enter()
